﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefRouteOperation" :model="stateRouteOperation.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_AddTime_FormItem" prop="Entity.AddTime" :label="$t('message.autotrans._Model_RouteOperation_AddTime')">
            <el-date-picker v-model="stateRouteOperation.vmModel.Entity.AddTime" type='date' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EditTime_FormItem" prop="Entity.EditTime" :label="$t('message.autotrans._Model_RouteOperation_EditTime')">
            <el-date-picker v-model="stateRouteOperation.vmModel.Entity.EditTime" type='date' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LastOperationCode_FormItem" prop="Entity.LastOperationCode" :label="$t('message.autotrans._Model_RouteOperation_LastOperationCode')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.LastOperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" :label="$t('message.autotrans._Model_RouteOperation_LineCode')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.LineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_NextNode_FormItem" prop="Entity.NextNode" :label="$t('message.autotrans._Model_RouteOperation_NextNode')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.NextNode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_NextOperationCode_FormItem" prop="Entity.NextOperationCode" :label="$t('message.autotrans._Model_RouteOperation_NextOperationCode')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.NextOperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_NextOperationId_FormItem" prop="Entity.NextOperationId" :label="$t('message.autotrans._Model_RouteOperation_NextOperationId')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.NextOperationId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationCode_FormItem" prop="Entity.OperationCode" :label="$t('message.autotrans._Model_RouteOperation_OperationCode')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.OperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationId_FormItem" prop="Entity.OperationId" :label="$t('message.autotrans._Model_RouteOperation_OperationId')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.OperationId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationName_FormItem" prop="Entity.OperationName" :label="$t('message.autotrans._Model_RouteOperation_OperationName')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.OperationName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderCode_FormItem" prop="Entity.OrderCode" :label="$t('message.autotrans._Model_RouteOperation_OrderCode')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.OrderCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderId_FormItem" prop="Entity.OrderId" :label="$t('message.autotrans._Model_RouteOperation_OrderId')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.OrderId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParentOperationCode_FormItem" prop="Entity.ParentOperationCode" :label="$t('message.autotrans._Model_RouteOperation_ParentOperationCode')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.ParentOperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParentOperationId_FormItem" prop="Entity.ParentOperationId" :label="$t('message.autotrans._Model_RouteOperation_ParentOperationId')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.ParentOperationId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_RouteName_FormItem" prop="Entity.RouteName" :label="$t('message.autotrans._Model_RouteOperation_RouteName')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.RouteName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_RouteNumber_FormItem" prop="Entity.RouteNumber" :label="$t('message.autotrans._Model_RouteOperation_RouteNumber')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.RouteNumber" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_RouteVersion_FormItem" prop="Entity.RouteVersion" :label="$t('message.autotrans._Model_RouteOperation_RouteVersion')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.RouteVersion" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleNumber_FormItem" prop="Entity.ScheduleNumber" :label="$t('message.autotrans._Model_RouteOperation_ScheduleNumber')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.ScheduleNumber" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Sort_FormItem" prop="Entity.Sort" :label="$t('message.autotrans._Model_RouteOperation_Sort')">
            <el-input v-model="stateRouteOperation.vmModel.Entity.Sort" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onSubmitRouteOperation"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

        <WtmButton @click="onCloseRouteOperation"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageBaseInformationRouteOperationCreate;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { routeoperationApi } from '/@/api/baseinformation/routeoperation';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefRouteOperation = ref();
const stateRouteOperation = reactive({
    vmModel: {
	  Entity:{
        AddTime: undefined,
        EditTime: undefined,
        LastOperationCode: '',
        LineCode: '',
        NextNode: '',
        NextOperationCode: '',
        NextOperationId: '',
        OperationCode: '',
        OperationId: '',
        OperationName: '',
        OrderCode: '',
        OrderId: '',
        ParentOperationCode: '',
        ParentOperationId: '',
        RouteName: '',
        RouteNumber: '',
        RouteVersion: '',
        ScheduleNumber: '',
        Sort: '',
      },

	},
    
});

// 取消
const onCloseRouteOperation = () => {
    closeDialog();
};

// 提交
const onSubmitRouteOperation = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefRouteOperation.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            routeoperationApi().add(stateRouteOperation.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};

// 页面加载时
onMounted(() => {
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

